package com.designpatternspart2.behavioraldesignpatterns.mediatorpattern;

import com.designpatternspart2.behavioraldesignpatterns.mediatorpattern.Mediator;

/**
 * File Name: Buyer1.java
 * Version: 
 * Description: 
 * Package: com.designpatternspart2.behavioraldesignpatterns.mediatorpattern
 * Author: Lance
 * Date: Apr 29, 2012
 */
class Buyer
{

    private Mediator mediator;
    private String unitOfCurrency;

    public Buyer(Mediator mediator, String unitOfCurrency)
    {
        this.mediator = mediator;
        this.unitOfCurrency = unitOfCurrency;
    }

    public boolean attemptToPurchase(float bid)
    {
        System.out.println("Buyer attempting a bid of " + bid + " " + getUnitOfCurrency());
        return getMediator().placeBid(bid, getUnitOfCurrency());
    }

    public Mediator getMediator()
    {
        return mediator;
    }

    public void setMediator(Mediator mediator)
    {
        this.mediator = mediator;
    }

    public String getUnitOfCurrency()
    {
        return unitOfCurrency;
    }

    public void setUnitOfCurrency(String unitOfCurrency)
    {
        this.unitOfCurrency = unitOfCurrency;
    }
}
